<?php $this->widget('OrgheaderWidget'); ?>
<div class="clear"></div>
<div class="row-fluid">
    <div class="span12">
        <div class="event-title">
            <select class="event-book">
                <?php if(isset($data)){ ?>
                    <?php foreach($data as $key => $events){ ?>
                        <?php if($key == 0) { ?>
                            <option selected value="<?php echo $events->event_id; ?>"><?php echo $events->main_title; ?></option>
                        <?php }else{ ?>
                            <option value="<?php echo $events->event_id; ?>"><?php echo $events->main_title; ?></option>
                        <?php }?>
                    <?php }?>
                <?php } ?>
            </select>
        </div>
        <div class="event-form">
            <?php // $this->renderPartial('_ticket_tab'); ?>

        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        var first_event = $('.event-book').select().val();
        getticket(first_event);
    });
    $('.event-book').on('change',function(){
        var event_id = $(this).val();
        getticket(event_id);
    });
    function getticket(event_id){
        $.ajax({
            url:'<?php echo Yii::app()->createAbsoluteUrl("organizer/getticket"); ?>',
            type: "POST",
            async:true,
            data: {event_id:event_id},
            beforeSend: function(){
                $('.event-form').empty();
                $('.event-form').append('<div class="loading"><div style="width:134px;height:100px;margin:0 auto;padding-top: 10px;"><img src="<?php echo Yii::app()->theme->baseUrl; ?>/frontend/images/ajaxloader.gif"></div></div>');
            },
            success: function(data){
                $(".event-form").html(data);
            }

        })
    }
</script>